using System;
using CodePlex.DnD4eCampaignManager.DnD4e.Interfaces;

namespace CodePlex.DnD4eCampaignManager.DnD4e
{
    public class Abilities : IAbilities, IEquatable<Abilities>
    {
        public int AbilityCharisma { get; set; }
        public int AbilityConstitution { get; set; }
        public int AbilityDexterity { get; set; }
        public int AbilityIntelligence { get; set; }
        public int AbilityStrength { get; set; }
        public int AbilityWisdom { get; set; }

        public override bool Equals(object obj)
        {
            if ( ReferenceEquals(null, obj) )
            {
                return false;
            }
            if ( ReferenceEquals(this, obj) )
            {
                return true;
            }
            if ( obj.GetType() != typeof ( Abilities ) )
            {
                return false;
            }
            return Equals((Abilities) obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                int result = AbilityCharisma;
                result = ( result * 397 ) ^ AbilityConstitution;
                result = ( result * 397 ) ^ AbilityDexterity;
                result = ( result * 397 ) ^ AbilityIntelligence;
                result = ( result * 397 ) ^ AbilityStrength;
                result = ( result * 397 ) ^ AbilityWisdom;
                return result;
            }
        }

        public bool Equals(Abilities other)
        {
            if ( ReferenceEquals(null, other) )
            {
                return false;
            }
            if ( ReferenceEquals(this, other) )
            {
                return true;
            }
            return other.AbilityCharisma == AbilityCharisma && other.AbilityConstitution == AbilityConstitution && other.AbilityDexterity == AbilityDexterity && other.AbilityIntelligence == AbilityIntelligence && other.AbilityStrength == AbilityStrength && other.AbilityWisdom == AbilityWisdom;
        }

        public static bool operator ==(Abilities left, Abilities right)
        {
            return Equals(left, right);
        }

        public static bool operator !=(Abilities left, Abilities right)
        {
            return !Equals(left, right);
        }
    }
}